package ast;

import mem.interfaces.IMem;
import out.Out;
import environnement.interfaces.IEnv;
import exceptions.LogoException;
import ast.interfaces.IAST;
import ast.interfaces.IASTprint;

public class ASTprint implements IASTprint{

	private IAST exp;

	public ASTprint(IAST exp){
		this.exp = exp;
	}
	
	@Override
	public Object eval(Out o, IEnv e, IMem m) throws LogoException {
		o.getS().add(getExp().eval(o, e, m).toString());
		
		return null;
	}

	@Override
	public String toTreeString(String ident, IEnv e, IMem m) {
		return ident + "PRINT " + exp.toTreeString(ident, e, m);
	}

	public IAST getExp() {
		return exp;
	}

	public void setExp(IAST exp) {
		this.exp = exp;
	}

	
}
